package org.dftproject.lineagelinkage.adapter;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.dftproject.genesis.data.genealogy.INamePart;

import edu.byu.cs428.twenty_gen.datamodel.pedigree.view.interfaces.IName;

public class GenName implements IName, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8775043458266063465L;

	private List<String> fragments;

	public GenName(org.dftproject.genesis.data.genealogy.IName name) {
		if (name != null && name.getNameParts() != null && name.getNameParts().size() > 0) {
			List<INamePart> parts = name.getNameParts();
			if (parts != null && parts.size() > 0) {
				fragments = new ArrayList<String>();
				for (INamePart part : parts) {
					if (part != null && part.getValue() != null && part.getValue().length() > 0) {
						fragments.add(part.getValue());
					}
				}
			}
		}
	}

	public List<String> getNameFragments() {
		return fragments;
	}
}
